<?php
class model__update_action_model extends database_mysql
{
    public function __construct()
    {
        parent::__construct();
        
    }
    
    public function md_ua_get_com_id($com_name)
    {
        $sql = "
                SELECT
                ".prefix."categories.ID
                FROM
                ".prefix."categories
                WHERE
                ".prefix."categories.Com = '$com_name' AND
                ".prefix."categories.Define = 'com'
        ";
        $rs = parent::mysql_fetch_one_rows($sql);
        return $rs;
    }
    
    public function md_ua_get_list_action()
    {
        
        $sql = "
                SELECT
                ".prefix."actions.ActName,
                ".prefix."actions.ID
                FROM
                ".prefix."actions
        ";
        $rs = parent::mysql_fetch_all_rows($sql);
        return $rs;
        
    }
    
    public function md_ua_check_action($com, $action, $app)
    {
        $sql = "
                SELECT
                ".prefix."com_act.ActID,
                ".prefix."com_act.ComID
                FROM
                ".prefix."com_act
                WHERE
                ".prefix."com_act.ComID = $com AND
                ".prefix."com_act.AppID = $app AND
                ".prefix."com_act.ActID = $action

        ";
        //echo $sql . '<br>';
        $rs = parent::mysql_fetch_one_rows($sql);
        return $rs;
    }
    
    public function md_ua_insert_action_com($data)
    {
        
        parent::mysql_insert_array(prefix.'com_act', $data);
    }
}